package com.imay.live.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.live.R;
import com.imay.live.helper.LevelHelper;
import com.imay.live.model.UserModel;
import com.imay.live.utils.GlideUtil;

import java.util.List;

/**
 * Created by  nick on 2017/4/18 0018.
 * 我的-关注的人列表
 */

public class ProfileFollowListAdapter extends BaseQuickAdapter<UserModel,BaseViewHolder> {

    public ProfileFollowListAdapter( List <UserModel> data) {
        super(R.layout.item_profile_follow, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, UserModel item) {
        helper.setText(R.id.tv_name_follow,item.getNick());
        helper.setText(R.id.tv_anchor_level_follow,item.getLiveLevel()+"");
        helper.setText(R.id.tv_user_level_follow,item.getUserLevel()+"");
        helper.setText(R.id.tv_imay_number_follow,String.format(mContext.getString(R.string.mine_room_id),item.getRoomId()));
        ImageView iv_head = helper.getView(R.id.iv_head_img_follow);
        GlideUtil.loadCircleImage(iv_head,item.getImgHead(),R.mipmap.pnl_00_head108);
        helper.getView(R.id.tv_user_level_follow).setBackgroundResource(LevelHelper.getUserLevelResId(item.getUserLevel()));
        helper.getView(R.id.tv_anchor_level_follow).setBackgroundResource(LevelHelper.getLiveLevelResId(item.getLiveLevel()));
        helper.setChecked(R.id.cb_profile_follow,item.isMyFollow());
        helper.addOnClickListener(R.id.iv_head_img_follow);
        helper.addOnClickListener(R.id.cb_profile_follow);
        helper.addOnClickListener(R.id.tv_name_follow);
        helper.setImageResource(R.id.iv_vip, LevelHelper.getVIPIcon(item.getVip()));

    }


}
